import 'package:flutter/widgets.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/material.dart';

class MyTest {
  PaintingContext context;
  Offset offset;

  MyTest(this.context, this.offset);

  void drawRect1() {
    double start_X = offset.dx;
    double start_y = offset.dy;
    double width = 100;

    final paint = Paint();
    context.canvas
        .drawRect(Rect.fromLTRB(start_X, start_y, start_X + width, start_y + 200), paint);
    start_X += width * 1.3;

    paint.color = Color(0xFF0000FF);
    paint.strokeWidth = 20;
    context.canvas
        .drawRect(Rect.fromLTRB(start_X, start_y, start_X + width, start_y + 200), paint);
    start_X += width * 1.3;

    final paint_copy = paint;
    paint_copy.style = PaintingStyle.stroke;
    context.canvas
        .drawRect(Rect.fromLTRB(start_X, start_y, start_X + width, start_y + 200), paint_copy);
    start_X += width * 1.3;

    paint.strokeMiterLimit = 0;
    paint.strokeWidth = 20;
    paint.style = PaintingStyle.stroke;
    context.canvas
        .drawRect(Rect.fromLTRB(start_X, start_y, start_X + width, start_y + 200), paint);
    start_X += width * 1.3;

    //no move in dart
    final paint_move = paint;
    paint_move.color = paint_move.color.withAlpha(128);
    context.canvas
        .drawRect(Rect.fromLTRB(start_X, start_y, start_X + width, start_y + 200), paint_move);
    start_X += width * 1.3;

    paint_move.strokeJoin = StrokeJoin.round;
    context.canvas
        .drawRect(Rect.fromLTRB(start_X, start_y, start_X + width, start_y + 200), paint_move);
    start_X += width * 1.3;

    paint_move.strokeJoin = StrokeJoin.bevel;
    context.canvas
        .drawRect(Rect.fromLTRB(start_X, start_y, start_X + width, start_y + 200), paint_move);
    start_X += width * 1.3;

    paint.color = Color(0xFF0000FF);
    paint.strokeWidth = 20;
    context.canvas
        .drawRect(Rect.fromLTRB(start_X, start_y, start_X + width, start_y + 200), paint);
    start_X += width * 1.3;
  }

  void runAllTest() {
    drawRect1();
  }
}
